<?php
	/**
	 * TEMPLATE CONTROLLERS
	 * @author Tom
	 * @package XiTemplate
	 */
	include_once(dirname(__FILE__).'/../config/WeXia.config.php');
	include_once(dirname(__FILE__).'/../views/XiTemplate.class.php');

	class WeXia extends XiTemplate
	{
		private $block;
		private $db;
		private $var;

		function __construct($var, $data = false, $db = false, $block = false)
		{
			$this->block = $block;
			$this->lang = $lang;
			$this->db = $db;
			$this->var = $var;
			$this->setTemp($data);
		}
		//set template -> variable store site config
		private function setTemp($data = false)
		{
			$var = $this->var;
			if(!is_array($var))
			{
				parent::__construct(dirname(__FILE__).WXTPL.$var);
			}

			if($data)
			{
				foreach($data as $key => $value)
				{
					$this->assign($key, $value);
				}
			}
			if(!$this->block)
				$this->parse('main');
		}
	}

?>